﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using StudioLib;

namespace StuCat
{
    public partial class RoomView : UserControl
    {
        public RoomView()
        {
            InitializeComponent();
        }

        public enum LabelType
        {
            Group,
            Name,
            Descript
        }
        public void AddLabel(String text, LabelType type)
        {
            if (text.Length < 5)
                return;
            Label lbl = new Label();

            
            lbl.Text = text;
            int fontsize = 14 ;
            Color clr = Color.Black;
            switch (type)
            {   
                case LabelType.Group:
                    fontsize = 20;
                    clr = Color.Red;
                    break;
                case LabelType.Name:

                    fontsize = 14;
                    clr = Color.Black;
                    lbl.Margin = new Padding(25, 0, 0, 0);
                    break;
                case LabelType.Descript:

                    fontsize = 12;
                    clr = Color.Gray;
                    lbl.Margin = new Padding(55, 0, 0, 0);
                    break;
            }
            lbl.Font = new Font("Tahoma", fontsize);
            lbl.ForeColor = clr;
            lbl.AutoSize = true;
            
            flowLayoutPanel1.Controls.Add(lbl);

            return;
        }

        public void LoadRoom(Room room)
        {
            this.roomName.Text = room.Name;

            AddLabel("Гитарное", LabelType.Group);

            foreach (Equipment gamp in room.GuitarAmps)
            {
                AddLabel(gamp.Name, LabelType.Name);
                AddLabel(gamp.Description, LabelType.Descript);
            }
            AddLabel("Басовое", LabelType.Group);
            foreach (Equipment bamp in room.BassAmps)
            {
                AddLabel(bamp.Name, LabelType.Name);
                AddLabel(bamp.Description, LabelType.Descript);
            }

            AddLabel("Прочий аппарат", LabelType.Group);
            foreach (Equipment oth in room.OtherMicrophones)
            {
                AddLabel(oth.Name, LabelType.Name);
                AddLabel(oth.Description, LabelType.Descript);
            }
            AddLabel("Прочий аппарат", LabelType.Group);
            AddLabel(room.Drums.Name, LabelType.Name);
            AddLabel(room.Drums.Description, LabelType.Descript);
        }

        private void RoomView_Load(object sender, EventArgs e)
        {

        }
    }
}
